package com.ys.zero.biz;

import java.util.ArrayList;
import java.util.List;

import com.ys.zero.bean.User;
import com.ys.zero.dao.ManageBackDao;
import com.ys.zero.util.VerifyRound;

/**
 * 
 *	管理员后台Biz
 *
 */
public class ManageBackBiz {
	private ManageBackDao dao = new ManageBackDao();

	/**
	 * 查询管理员
	 * @return 
	 */
	public List<User> queryManages() {
		return dao.queryManages();
	}
	/**
	 * 增加管理员
	 * @return 
	 */
	public User addManages(User manage) {
		//获得账号与密码
		User user = new User();
		user.setAccount(VerifyRound.getRound());
		user.setPwd("123456");
		
		String account = user.getAccount();
		String pwd = user.getPwd();
		//业务判断
		dao.addManages(account
			,pwd
			,manage.getRealName()
			,manage.getLocation()
			,manage.getSuperior()
			,manage.getSex().equals("男")?0:1
			,manage.getTelphone()
			,manage.getEmail()
			,manage.getIntroduction());
		return user;
	}
	/**
	 * 修改密码
	 * @param id
	 * @param newPwd
	 */
	public void updatePwd(String id, String newPwd) {
		dao.updatePwd(id,newPwd);
	}
}
